package com.example.sb.converter;

import com.example.sb.pojo.User;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

/**
 * @author kedong.lin
 */
@Component
public class String2UserConverter implements Converter<String, User> {
    @Override
    public User convert(String s) {
        String[] s1 = s.split("-");
        User user = new User();
        user.setId(Long.parseLong(s1[0]));
        user.setUserName(s1[1]);
        user.setNote(s1[2]);
        return user;
    }
}
